<?php

namespace Gd11x5\Controller;

class CodeController extends CommonController {
	
	
	

	//获取最新一期开奖数
	function get_new_code() {
		
		$codeModel = D ('Gd11x5Code');
		$result = $codeModel->order('code_key desc')->find();
		
		$session_id = I("session_id");
		$user_info = S($session_id);
		if(!$user_info){
			$json_result['status_code']=101;//找不到用户
			$json_result['message']="未登陆或登陆失效";//找不到用户
			$json_result['result']='';
			echo json_encode($json_result,JSON_UNESCAPED_UNICODE);
			exit();
		}
		//判断这个id是否有效
		$user_session_id = S($user_info['id']);
		if($user_session_id!=$session_id){
			$result['status_code']=105;//用户session过期
		}else{
			$result['status_code']=100;
		}
		
		echo json_encode($result,JSON_UNESCAPED_UNICODE);
	}
					
}









